Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(popup-menu): add API to provide custom no search results entry #847

Merged
merged 4 commits into from
Jan 30, 2024

Conversation

philippfromme
Copy link
Contributor

@philippfromme philippfromme commented Jan 17, 2024

Adds getEmptyPlaceholder API to PopupMenuProvider to customize what's shown when there are no entries (after search). Based on the original issue is clear that a simple string or even an HTML string as it's used for icons (imgHtml) won't cut it here which means we have to allow users to return a VNode. The search is passed to the callback returning the VNode so it can be taken into account.

Example

brave_CVRyjayZfB


Closes #846

@bpmn-io-tasks bpmn-io-tasks bot added the needs review Review pending label Jan 17, 2024
@philippfromme philippfromme force-pushed the custom-no-search-results branch from bc6d149 to c00fcab Compare January 17, 2024 15:34
@philippfromme philippfromme force-pushed the custom-no-search-results branch 2 times, most recently from 45904e0 to 810f1bf Compare January 18, 2024 09:38
@philippfromme
Copy link
Contributor Author

@nikku I adjusted the implementation as suggested. The search is now passed to the callback, which returns the custom node.

@philippfromme philippfromme requested a review from nikku January 18, 2024 09:50
@philippfromme philippfromme force-pushed the custom-no-search-results branch 9 times, most recently from c1f3aa9 to 8c33f15 Compare January 19, 2024 08:55
@nikku
Copy link
Member

nikku commented Jan 19, 2024

🙃 How looks did out? Did you complete fine tuning this PR?

@philippfromme philippfromme force-pushed the custom-no-search-results branch 2 times, most recently from c39750e to baa7391 Compare January 19, 2024 12:19
@philippfromme
Copy link
Contributor Author

philippfromme commented Jan 19, 2024

🙃 How looks did out? Did you complete fine tuning this PR?

Unfortunately, I got stuck due to failing tests on Linux & Firefox. They are extremely flaky so I replaced whenStable with @testing-library/waitFor (which we are using in the properties panel, too) and increased the timeouts.

@philippfromme philippfromme marked this pull request as draft January 19, 2024 12:22
@bpmn-io-tasks bpmn-io-tasks bot added in progress Currently worked on and removed needs review Review pending labels Jan 19, 2024
@philippfromme philippfromme force-pushed the custom-no-search-results branch 4 times, most recently from 47ae206 to ce76967 Compare January 19, 2024 14:14
@philippfromme philippfromme marked this pull request as ready for review January 19, 2024 14:56
@bpmn-io-tasks bpmn-io-tasks bot added needs review Review pending and removed in progress Currently worked on labels Jan 19, 2024
@philippfromme
Copy link
Contributor Author

@nikku Should be ready to be reviewed now. What a pain in the 🍑 that was.

@nikku
Copy link
Member

nikku commented Jan 23, 2024

@philippfromme As discussed I went forth and do a little bit more work on this PR:

  • Now we need to expose an getEmptyPlaceholder hook to be used for integration.
  • The first hook (by priority) wins and will be taken.
  • We don't ship a default empty placeholder, but instead rely on integrators to ship it. This solves the issue that all but this string were already translatable, and translation usually happens in integrating libraries. We can discuss this as I found one additional, not translated string: Open element documentation.

Please checkout what I did and see if it makes sense.

@philippfromme philippfromme requested a review from nikku January 30, 2024 10:04
@philippfromme
Copy link
Contributor Author

Looks good to me. @nikku I requested another review so feel free to approve and merge.

philippfromme and others added 4 commits January 30, 2024 11:14
Concatenating all searchable fields using `---` results in matching non-existing fields, e.g. `foo---bar`.

test(popup-menu): add search test coverage
Ensures we call out what the things are, following our existing patterns of providers and consumers.

BREAKING CHANGES: PopupMenu *Callback types renamed to *Provider.
@nikku nikku force-pushed the custom-no-search-results branch from 4473f65 to 18c7bf2 Compare January 30, 2024 10:19
@nikku nikku merged commit 228b405 into develop Jan 30, 2024
12 checks passed
@nikku nikku deleted the custom-no-search-results branch January 30, 2024 10:40
@bpmn-io-tasks bpmn-io-tasks bot removed the needs review Review pending label Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make Empty Search Results of Popup Menu Customizable
2 participants